Skip to content

fix(frontend): correct cache hit rate denominator#2301

Closed
jiwangyihao wants to merge 1 commit intoWei-Shaw:mainfrom
jiwangyihao:fix/cache-hit-rate-2291
Closed

fix(frontend): correct cache hit rate denominator#2301
jiwangyihao wants to merge 1 commit intoWei-Shaw:mainfrom
jiwangyihao:fix/cache-hit-rate-2291

Conversation

@jiwangyihao
Copy link
Copy Markdown

Summary

  • Fix the token usage trend Cache Hit Rate denominator to use all prompt tokens: input_tokens + cache_read_tokens + cache_creation_tokens.
  • Add a regression test covering the OpenAI OAuth stats case where cache reads were displayed as 100% when cache creation was zero.

Fixes #2291

Tests

  • pnpm test:run src/components/charts/__tests__/TokenUsageTrend.spec.ts
  • pnpm typecheck
  • pnpm exec eslint src/components/charts/TokenUsageTrend.vue src/components/charts/__tests__/TokenUsageTrend.spec.ts
  • git diff --check

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@jiwangyihao
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cache Hit Rate 的计算方式有误

1 participant